package com.waiting.design.observe;

/**
 * @Description
 * @Author bjweitingting
 * @Date 2018/11/27
 **/
public class Main {
    public static void main(String[] args) {
        //被观察着
        PubMessage pubMessage = new PubMessage();
        //观察者
        ConsumerMessage consumerMessage = new ConsumerMessage();
        //消息订阅
        pubMessage.addObserver(consumerMessage);

        //被观察着生产消息
        for (int i = 0; i < 3; i++) {
            System.out.println(" --------------");
            pubMessage.pubMessage();
        }
    }
}
